import time

from selenium.webdriver.firefox.webdriver import WebDriver
from selenium.webdriver.support.select import Select

import testcase


class zilianguanli():
    def zilianguanli(self):
        zilianguanli=testcase.testcase.driver.find_element_by_css_selector("#root > div > div > section > aside > div.ant-layout-sider-children > ul > li:nth-child(2) > span.ant-menu-title-content > a")
        return zilianguanli
    def creatorg(self):
        creatorg=testcase.testcase.driver.find_element_by_xpath("//*[@id=\"root\"]/div/div/section/section/main/div/div/div[2]/div[2]/div[1]/div")
        return creatorg
    def orgname(self):
        orgname=testcase.testcase.driver.find_element_by_id("CreateLeague_name")
        return orgname
    def orgdomin(self):
        orgdomin=testcase.testcase.driver.find_element_by_id("CreateLeague_domain")
        return orgdomin
    def commit(self):
        commit=testcase.testcase.driver.find_element_by_xpath("//*[@id=\"CreateLeague\"]/div[8]/div/div/div/button[1]")
        return commit
    def peer(self):
        """选择类型为peer类型组织"""
        peer=testcase.testcase.driver.find_element_by_xpath("//*[@id=\"CreateLeague_type\"]/label[2]/span[1]/input")
        return peer
    def creatleague(self):
        creatleague=testcase.testcase.driver.find_element_by_xpath("/html/body/div/div/div/section/section/main/div/div/div[3]/div/div/div[2]/div/div/span")
        return creatleague
    def zilianhangye(self):
        """点击选中行业"""
        testcase.testcase.driver.find_element_by_id("CreateLeague_industry").click()
        time.sleep(2)
        tags = testcase.testcase.driver.find_element_by_css_selector('.ant-select-item-option-active > .ant-select-item-option-content')
        return tags
    def toupiaocelue(self):
        toupiaocelue=testcase.testcase.driver.find_element_by_id("CreateLeague_vote_strategy")
        return toupiaocelue
    def selectorder(self):
        testcase.testcase.driver.find_element_by_id("CreateLeague_orderer_orgs").click()
        time.sleep(2)
        testcase.testcase.driver.find_element_by_xpath("//div/div/div[2]/div/div/div/div/div").click()
        return "选中order组织"
    def selectpeer(self):
        testcase.testcase.driver.find_element_by_id("CreateLeague_peer_orgs")
        testcase.testcase.driver.find_element_by_xpath("//div[3]/div/div/div/div[2]/div/div/div/div/div").click()
        return "选中peer组织"